import json
import sys
import re

quotes = [
  "AUD",
  "BIDR",
  "BNB",
  "BRL",
  "BTC",
  "BUSD",
  "DAI",
  "DOGE",
  "ETH",
  "EUR",
  "GBP",
  "IDRT",
  "NGN",
  "RUB",
  "TRX",
  "TRY",
  "TUSD",
  "UAH",
  "USDC",
  "USDP",
  "USDT",
  "UST",
  "VAI",
  "XRP",
  "PAX",
]

quotes = '|'.join(quotes)
product_re = '^([A-Z0-9]{2,12})(' + quotes + ')$';
product_re1 = '^([A-Z0-9]{2,12})(USD)$';
product_re_cap = '^(?P<base>[A-Z0-9]{2,12})(?P<quote>' + quotes + ')$';
product_re_cap1 = '^(?P<base>[A-Z0-9]{2,12})(?P<quote>USD)$';


def parse_spot(s):
  r = re.match(product_re_cap, s)
  if r:
    return r.groupdict()
  r = re.match(product_re_cap1, s)
  return r.groupdict()

r = parse_spot(sys.argv[1])
print(json.dumps(r))
